package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Controller
    public class ThymeleafController {

        @RequestMapping(value = "/request/authorize", method = RequestMethod.GET)
        public String show(Model model, @RequestBody Oauth2Req oauth2Req){
            model.addAttribute("uid","123456789");
            model.addAttribute("name",oauth2Req.getApplicationName());
            model.addAttribute("oauth2Req",oauth2Req);
            return "show";
        }

    }

    @RequestMapping(value = "/request/hello", method = RequestMethod.GET)
    public String hello(){
        return "hello world";
    }

}
